package com.example.demo.serviceimp;

import com.example.demo.entity.TestPaper;
import com.example.demo.mapper.PaperMapper;
import com.example.demo.service.PaperService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@Service
public class PaperServiceImp implements PaperService {
    @Resource
    private PaperMapper paperMapper;

    /**
     * 查询章节试卷
     * */
    @Override
    public TestPaper selpaper(Integer chapter_id) {
        return paperMapper.selpaper(chapter_id);
    }

    /**
     * 查询所有试卷
     * */
    @Override
    public List<TestPaper> selallpaper() {
        return paperMapper.selallpaper();
    }

    /**
     * 增加试卷
     * */
    @Override
    public int inspaper(String test_paper_name,Integer chapter_id) {
        return paperMapper.inspaper(test_paper_name,chapter_id);
    }

    /**
     * 更改试卷
     * */
    @Override
    public int updpaper(String test_paper_name, Integer chapter_id, Integer test_paper_id) {
        return paperMapper.updpaper(test_paper_name,chapter_id,test_paper_id);
    }

    /**
     * 删除试卷
     * */
    @Override
    public int delpaper(Integer test_paper_id) {
        return paperMapper.delpaper(test_paper_id);
    }

    /**
     * 改变试卷状态
     * */
    @Override
    public int updpastu(Integer test_paper_id) {
        return paperMapper.updpastu(test_paper_id);
    }

    /**
     * 查询用户是否已经做过此章节试卷
     * */
    @Override
    public List seltqrecord(Integer tpid, Integer uid) {
        return paperMapper.seltqrecord(tpid, uid);
    }

    @Override
    public List seltqrecordopid(Integer tpid, Integer uid) {//选项ID
        return paperMapper.seltqrecordopid(tpid, uid);
    }

    /**
     * 查询已做试卷的试题
     * */
    @Override
    public List selrecordtqname(Integer tqid) {
        return paperMapper.selrecordtqname(tqid);
    }

    /**
     * 查询已做试卷的试题的选项
     */
    @Override
    public List selrtqopt(Integer tqid) {
        return paperMapper.selrtqopt(tqid);
    }
}
